class JobObserver < ActiveRecord::Observer
  def after_create(job)
    # notify volcom about posting
    UserNotifier.deliver_job_posting_notification(job)
  end

  def after_save(job)
    # Notify all users who are eligible that a new job has been opened
    if job.recently_opened?
      @users = job.find_eligible_users
      @users.each do |user|
        UserNotifier.deliver_job_possibility_notification(user)        
      end
    end
  end
end